home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / diffeq.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  142 lines

  1. (Comp.sys.handhelds) 
  2. Item: 890 by gt3398b at prism.gatech.EDU 
  3. Author: [DELANO,ANDREW DOUGLAS] 
  4.   Subj: DIFFERENTIAL EQUATIONS ON THE HP48SX 
  5.   Date: Fri Oct 12 1990 07:53  
  6.  
  7. Here are some programs I wrote to do Euler's method, Improved Euler's method, 
  8. Taylor series method, and Runge Kutta method for solving differential equations 
  9. on the 48.  They were very useful in this quarters diffeqs class.  I hope 
  10. somebody else out there finds them helpful.  I didn't know of any other progams 
  11. like these existing so I wrote them myself.  If anybody else has any 
  12. improvements, suggestions, or questions, please email me.  Also if I would be 
  13. interested to know how many of you like them so if you do use them, please let 
  14. me know.  Maybe somebody can put these on an ftp site for those who miss this.  
  15. Anyway, here are some genral instructions and the programs. 
  16.  
  17. 1. Download this directory into your hp48sx. [It's called DIFFEQ on disk. jkh] 
  18.  
  19. 2. There are 6 programs: EULR1,EULR2,TAYLr,R.K.,ENTR,PLT. You can use EULR1, 
  20.    EULR2, TAYLr, and R.K. to solve equations.  ENTR and PLT are utilities. 
  21.  
  22. 3. Just press the method you wish and follow instructions. 
  23.  
  24.                  GOOD LUCK 
  25.  
  26.              Andy Delano 
  27.  
  28. Here is the directory: 
  29.  
  30. _________________________________________________________________________ 
  31.  
  32. %%HP: T(3)A(D)F(.); 
  33. DIR 
  34.   EULR1 
  35.     \<< ENTR 
  36.       DO DE EVAL h 
  37. * Y + DUP 'Y' STO X 
  38. h + 'X' STO X SWAP 
  39. { 1 2 } \->ARRY \GS+ 
  40.       UNTIL X S == 
  41.       END { X Y DE 
  42. h S IV XS } PURGE 
  43. PLT 
  44.     \>> 
  45.   EULR2 
  46.     \<< ENTR 
  47.       DO DE EVAL 
  48. DUP h * Y + Y SWAP 
  49. 'Y' STO X h + 'X' 
  50. STO DE EVAL SWAP 
  51. 'Y' STO X h - 'X' 
  52. STO + h 2 / * Y + 
  53. DUP 'Y' STO X h + 
  54. 'X' STO X SWAP { 1 
  55. 2 } \->ARRY \GS+ 
  56.       UNTIL X S == 
  57.       END { X Y DE 
  58. h S IV XS } PURGE 
  59. PLT 
  60.     \>> 
  61.   TAYLr 
  62.     \<< ENTR 
  63.       DO DE 'X' \.d 
  64. DE 'Y' \.d DE EVAL * 
  65. + h 2 ^ 2 / * DE 
  66. EVAL h * + Y + DUP 
  67. 'Y' STO X h + 'X' 
  68. STO X SWAP { 1 2 } 
  69. \->ARRY \GS+ 
  70.       UNTIL X S == 
  71.       END { X Y DE 
  72. h S IV XS } PURGE 
  73. PLT 
  74.     \>> 
  75.   R.K. 
  76.     \<< ENTR 
  77.       DO DE EVAL 
  78. 'K1' STO h .5 * X + 
  79. 'X' STO Y DUP .5 h 
  80. * K1 * + 'Y' STO DE 
  81. EVAL 'K2' STO DUP 
  82. .5 h * K2 * + 'Y' 
  83. STO DE EVAL 'K3' 
  84. STO .5 h * X + 'X' 
  85. STO DUP h K3 * + 
  86. 'Y' STO DE EVAL 
  87. 'K4' STO 'Y' STO X 
  88. h - 'X' STO K1 2 K2 
  89. * 2 K3 * K4 + + + h 
  90. 6 / * Y + 'Y' STO X 
  91. h + 'X' STO X Y { 1 
  92. 2 } \->ARRY \GS+ 
  93.       UNTIL X S == 
  94.       END { K4 K3 
  95. K2 K1 X Y DE h XS S 
  96. IV } PURGE PLT 
  97.     \>> 
  98.   ENTR 
  99.     \<< 
  100. "Enter Equation 
  101. y'=:" 
  102. "''" INPUT 
  103. "Enter Step Size (h):" 
  104. "" INPUT 
  105. "Enter X Startpoint:" 
  106. "" INPUT 
  107. "Enter X Endpoint:" 
  108. "" INPUT 
  109. "Enter Intial 
  110. Value(X,Y):" 
  111. "()" INPUT OBJ\-> 
  112. 'IV' STO OBJ\-> 'S' 
  113. STO OBJ\-> 'XS' STO 
  114. OBJ\-> 'h' STO OBJ\-> 
  115. 'DE' STO IV V\-> 'Y' 
  116. STO 'X' STO '\GSDAT' 
  117. PURGE X Y { 1 2 } 
  118. \->ARRY \GS+ XS 'X' STO 
  119. CLLCD 
  120. "    Please Wait..." 
  121. 2 DISP 0 FREEZE 
  122.     \>> 
  123.   PLT 
  124.     \<< 
  125. "Would you like 
  126. to plot the results? 
  127. (Y/N)" 
  128. "" INPUT 'a' STO 
  129.       IF a "Y" == 
  130.       THEN ERASE 
  131. SCATRPLOT GRAPH 
  132.       ELSE 
  133.       END \GSDAT { 
  134. \GSPAR PPAR a } PURGE 
  135.     \>> 
  136. END 
  137. --  
  138. DELANO,ANDREW DOUGLAS 
  139. Georgia Institute of Technology, Atlanta Georgia, 30332 
  140. uucp:     ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt3398b 
  141. Internet: gt3398b@prism.gatech.edu 
  142.